import rospy
import json
import sys
import os

from manager.srv import (
  TextToSpeechSrv,
  TextToSpeechSrvResponse
  )

from std_msgs.msg import String

class TextToSpeech:

  def __init__(self):
    # Speech recognition service published
    self.serv_topic = "aiui_tts_topic"

    self.serv = rospy.Service(self.serv_topic, \
        TextToSpeechSrv, self.text_to_speech_callback)

    self.aiui_tts = rospy.Publisher('tts', String, queue_size=1)

  # The service callback
  def text_to_speech_callback(self, req):

    res = TextToSpeechSrvResponse()
    self.aiui_tts.publish(req.text)
    # req.text
    return res

if __name__ == "__main__":
  rospy.init_node('rapp_aiui_tts_ros_node')
  rapp_aiui_tts_ros_node = TextToSpeech()
  rospy.spin()


